package com.example.manager.entity;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class DateFormatExample {
    public static void main(String[] args) {
        String originalDateString = "Sun Aug 25 08:00:00 CST 2024";
        SimpleDateFormat inputFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH);
        SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd");

        try {
            Date date = inputFormat.parse(originalDateString);
            String formattedDate = outputFormat.format(date);
            System.out.println(formattedDate); // 输出应该是: 2024-08-25
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }
}